﻿using System;
using System.ServiceModel;

namespace EnterpriseServices.Service
{
    [ServiceContract(Name = "RoleManagerREST", Namespace = "http://EnterpriseServices.CodePlex.com/2009/03/06")]
    public interface IRoleManagerREST
    {
        /// <summary>
        /// Adds the specified userNames to the specified roleName.
        /// </summary>
        /// <param name="applicationName">The applicationName.</param>
        /// <param name="userNames">The user names.</param>
        /// <param name="roleName">The roleName.</param>
        [OperationContract]
        void AddUsersToRole(string applicationName, string userNames, string roleName);

        /// <summary>
        /// Adds the specified userNames to the specified roleNames.
        /// </summary>
        /// <param name="applicationName">The applicationName.</param>
        /// <param name="userNames">The user names.</param>
        /// <param name="roleNames">The roleNames.</param>
        [OperationContract]
        void AddUsersToRoles(string applicationName, string userNames, string roleNames);

        /// <summary>
        /// Adds the specified user to the specified roleName.
        /// </summary>
        /// <param name="applicationName">The applicationName.</param>
        /// <param name="userName">Name of the user.</param>
        /// <param name="roleName">The roleName.</param>
        [OperationContract]
        void AddUserToRole(string applicationName, string userName, string roleName);

        /// <summary>
        /// Adds the specified user to the specified roleNames.
        /// </summary>
        /// <param name="applicationName">The applicationName.</param>
        /// <param name="userName">Name of the user.</param>
        /// <param name="roleNames">The roleNames.</param>
        [OperationContract]
        void AddUserToRoles(string applicationName, string userName, string roleNames);

        /// <summary>
        /// Adds a new roleName to the data source.
        /// </summary>
        /// <param name="applicationName">The applicationName.</param>
        /// <param name="roleName">The roleName.</param>
        [OperationContract]
        void CreateRole(string applicationName, string roleName);

        /// <summary>
        /// Removes a roleName from the data source. If throwOnPopulatedRole is true,throws an exception if roleName has one or more members.
        /// </summary>
        /// <param name="applicationName">The applicationName.</param>
        /// <param name="roleName">The roleName.</param>
        /// <param name="throwOnPopulatedRole">if set to <c>true</c> [throw on populated roleName].</param>
        /// <returns></returns>
        [OperationContract]
        bool DeleteRole(string applicationName, string roleName, string throwOnPopulatedRole);

        /// <summary>
        /// Removes all the roleNames from the data source. If throwOnPopulatedRole is true,throws an exception if any of the roleNames has one or more members
        /// </summary>
        /// <param name="applicationName">The applicationName.</param>
        /// <param name="throwOnPopulatedRole">if set to <c>true</c> [throw on populated roleName].</param>
        [OperationContract]
        void DeleteAllRoles(string applicationName, string throwOnPopulatedRole);

        /// <summary>
        /// Gets a list of all the roleNames for the applicationName.
        /// </summary>
        /// <param name="applicationName">The applicationName.</param>
        /// <returns></returns>
        [OperationContract]
        String[] GetAllRoles(string applicationName);

        /// <summary>
        /// Gets a list of the roleNames that a user is in.
        /// </summary>
        /// <param name="applicationName">The applicationName.</param>
        /// <param name="userName">Name of the user.</param>
        /// <returns></returns>
        [OperationContract]
        String[] GetRolesByUser(string applicationName, string userName);

        /// <summary>
        /// Gets a list of userNames in the specified roleName.
        /// </summary>
        /// <param name="applicationName">The applicationName.</param>
        /// <param name="roleName">The roleName.</param>
        /// <returns></returns>
        [OperationContract]
        String[] GetUsersInRole(string applicationName, string roleName);

        /// <summary>
        /// Removes the specified user from the specified roleName.
        /// </summary>
        /// <param name="applicationName">The applicationName.</param>
        /// <param name="userName">Name of the user.</param>
        /// <param name="roleName">Name of the roleName.</param>
        [OperationContract]
        void RemoveUserFromRole(string applicationName, string userName, string roleName);

        /// <summary>
        /// Removes the specified userNames from the specified roleName.
        /// </summary>
        /// <param name="applicationName">The applicationName.</param>
        /// <param name="userNames">The userNames.</param>
        /// <param name="roleName">The roleName.</param>
        [OperationContract]
        void RemoveUsersFromRole(string applicationName, string userNames, string roleName);

        /// <summary>
        /// Removes the specified user from the specified roleNames.
        /// </summary>
        /// <param name="applicationName">The applicationName.</param>
        /// <param name="user">The user.</param>
        /// <param name="roleNames">The roleNames.</param>
        [OperationContract]
        void RemoveUserFromRoles(string applicationName, string userName, string roleNames);

        /// <summary>
        /// Removes the specified user names from the specified roleNames.
        /// </summary>
        /// <param name="applicationName">The applicationName.</param>
        /// <param name="userNames">The userNames.</param>
        /// <param name="roleNames">The roleNames.</param>
        [OperationContract]
        void RemoveUsersFromRoles(string applicationName, string userNames, string roleNames);

        /// <summary>
        /// Returns true if roleName management is enabled; otherwise,false
        /// </summary>
        /// <param name="applicationName">The applicationName.</param>
        /// <returns>
        /// 	<c>true</c> if [is roleNames enabled] [the specified applicationName]; otherwise, <c>false</c>.
        /// </returns>
        [OperationContract]
        bool IsRolesEnabled(string applicationName);

        /// <summary>
        /// Returns true if the roleName name already exists in the data source; otherwise,false.
        /// </summary>
        /// <param name="applicationName">The applicationName.</param>
        /// <param name="roleName">The roleName.</param>
        /// <returns></returns>
        [OperationContract]
        bool RoleExists(string applicationName, string roleName);
    
    }
}
